module.exports = (vm) => {
  return {
    // 登录认证相关接口
    login: (params = {}, header = {}) => vm.$u.post("/auth/login", params, {isToken: false}),
    logout: (params = {}, header = {}) => vm.$u.delete("/auth/token/logout", params, header),
	getCodeImg: (params = {}, header = {}) => vm.$u.get("/code", params, header),

    // 获取租户列表
    tenant: (params = {}) => vm.$u.get("/admin/tenant/list", params),

    // 字典
    dictData: (params = {}) => vm.$u.get("/admin/dict/type/" + params.dictType),

    // 个人信息
    user: {
      getUserInfo: () => vm.$u.get("/system/user/getInfo"),
      updateUserInfo: (params = {}) => vm.$u.put("/admin/user/edit", params),
      infoSaveBase: (params = {}) => vm.$u.post("/admin/sys/user/infoSaveBase", params),
      infoSavePwd: (params = {}) => vm.$u.post("/admin/sys/user/infoSavePwd", params),
    },

    // 字典
    dict: {
      type: (params = {}) => vm.$u.get("/admin/dict/type/" + params),
    },

    // 文件管理
    unixFile: {
      upload: (params = {}) => vm.$u.post("/admin/sys-file/upload"),
    },

    // unix 部门管理
    unixDept: {
      list: (params = {}) => vm.$u.get("/admin/dept/list", params),
    },

    // 岗位管理
    unixPost: {
      // 列出所有
      list: (params = {}) => vm.$u.get("/admin/post/list", params),

      // 分页
      fetchList: (params = {}) => vm.$u.get("/admin/post/page", params),

      // 新增
      addObj: (obj = {}) => vm.$u.post("/admin/post", obj),

      // 修改
      putObj: (obj = {}) => vm.$u.put("/admin/post", obj),

      // 删除
      delObj: (params) => vm.$u.delete("/admin/post/" + params.id),

      // 查询
      getObj: (params) => vm.$u.get("/admin/post/" + params.id),
    },

    // unix 角色管理
    unixRole: {
      // 列出所有
      list: (params = {}) => vm.$u.get("/admin/role/list", params),

      // 分页
      fetchList: (params = {}) => vm.$u.get("/admin/role/page", params),

      // 新增
      addObj: (obj = {}) => vm.$u.post("/admin/role", obj),

      // 修改
      putObj: (obj = {}) => vm.$u.put("/admin/role", obj),

      // 删除
      delObj: (params) => vm.$u.delete("/admin/role/" + params.id),

      // 查询
      getObj: (params) => vm.$u.get("/admin/role/" + params.id),
    },

    // unix 用户管理
    unixUser: {
      page: (params = {}) => vm.$u.get("/admin/user/page", params),
      delete: (params = {}) => vm.$u.delete("/admin/user/" + params.id),
      getOne: (params = {}) => vm.$u.get("/admin/user/" + params.id),
      putObj: (params = {}) => vm.$u.put("/admin/user", params),
    },

    //unix 令牌管理
    unixToken: {
      page: (params = {}) => vm.$u.get("/admin/token/page", params),
      delete: (params = {}) => vm.$u.delete("/admin/token/" + params.token),
    },

    //unix 日志管理
    unixLog: {
      page: (params = {}) => vm.$u.get("/admin/log/page", params),
      delete: (params = {}) => vm.$u.delete("/admin/log/" + params.id),
    },

    // unix 工作流
    unixOA: {
      queryTodos: (params = {}) => vm.$u.get("/act/task/todo", params),
      queryBill: (params = {}) => vm.$u.get("/act/leave-bill/" + params.leaveId),
      delBill: (params = {}) => vm.$u.delete("/act/leave-bill/" + params.leaveId),
      submitBill: (params = {}) => vm.$u.get("/act/leave-bill/submit/" + params.leaveId),
      queryBillPage: (params = {}) => vm.$u.get("/act/leave-bill/page", params),
      getTask: (params = {}) => vm.$u.get("/act/task/" + params.taskId),
      addTask: (params = {}) => vm.$u.post("/act/leave-bill", params),
      doTask: (params = {}) => vm.$u.post("/act/task", params),
    },

    // unix 租户管理
    unixTenant: {
      // 分页
      fetchList: (params = {}) => vm.$u.get("/admin/tenant/page", params),

      // 新增
      addObj: (obj = {}) => vm.$u.post("/admin/tenant", obj),

      // 修改
      putObj: (obj = {}) => vm.$u.put("/admin/tenant", obj),

      // 删除
      delObj: (params) => vm.$u.delete("/admin/tenant/" + params.id),

      // 查询
      getObj: (params) => vm.$u.get("/admin/tenant/", params),
    },

    // unix 参数管理
    unixParam: {
      // 分页
      fetchList: (params = {}) => vm.$u.get("/admin/param/page", params),

      // 新增
      addObj: (obj = {}) => vm.$u.post("/admin/param", obj),

      // 修改
      putObj: (obj = {}) => vm.$u.put("/admin/param", obj),

      // 删除
      delObj: (params) => vm.$u.delete("/admin/param/" + params.id),

      // 查询
      getObj: (params) => vm.$u.get("/admin/param/" + params.id),
    },
  };
};
